Changes to Liberty BASIC v1.4 (stuff added since v1.3) ------------------------------------------------------------------------ First, the new stuff in summary! * Added communications support! * Added user preferences dialog! * Added support for block IF/THEN/ELSE/ENDIF structures! * Added command lines switches so you can use the editor of your choice! * Added font support to most controls! * Added auto-backup of your work when running/debugging! * Added a compile progress bar! ...and more! Here are the new features and bug fixes in more detail! 1) FIXED! Wrong line highlighted when unfinished string compile error occurs. 2) FIXED! Floating point values lose their fractional part when reading from a random access file. 3) Added a TITLEBAR statement to change the label of a program's main window. titlebar "A new title!" 4) Added the AUTORESIZE command to textedit and graphicbox controls so that they can automatically resize themselves when their parent window resizes. When a control is sent this command, each edge of a control will maintain the same distance from its parent window's respective edge. 5) The random number generator now automatically reseeds when Liberty BASIC starts. 6) FIXED! An 'index out of range' error to occur when using the MID$() function in certain unusual circumstances has been fixed. This also improves performance of the function. 7) Sometimes when enlarging a window with graphics drawn in it, Liberty BASIC would fail to completely refill then entire window with a chosen fill color. This has been fixed. 8) Added the ability to define a default pushbutton for a dialog type window. By specifying a button with a handle extension of .default, that button will become the default pushbutton for the dialog box in which it resides. NOTE: The default pushbutton cannot be placed inside of a groupbox. 'example of setting up a default pushbutton button #main.default, "OK", [accept], UL, 10, 10, 50, 25 9) Added a Preferences dialog to the Setup menu containing: - option to confirm on exit of Liberty BASIC - option to display execution complete notice - option to add Kill BASIC Programs to system menu of all windows - option to start Liberty BASIC as full screen - option to show a compile progress dialog 10) Now when making a *.TKN file a file dialog will open and let you change the default destination filename. 11) Now you can change the text label of a button by printing to it: button #1.bttn, "Click me", [ok], UL, 10, 10, 150, 25 open "test" for window as #1 input r$ [ok] count = count + 1 print #1.bttn, "Clicked "; count; " times." input r$ 12) Block IF/THEN support added. IF/THEN blocks can be nested, and two formats are supported: a = 5 if a = 5 then print "variable" print "a is 5" else print "these lines" print "will not execute" end if alternatively: a = 5 if a = 5 then print "variable" print "a is 5" end if Nested blocks are permitted: a = 5 if a = 5 then confirm "Display whether a is 5?"; answer$ if answer$ = "yes" then print "variable" print "a is 5" end if else print "these lines" print "will not execute" end if 13) FIXED! If a delsegment command fails, a proper error message is now presented. 14) Communications support has been added... 15) The INPUT$() function has been revamped and is now much faster. 16) The !contents commands for text windows and texteditor controls now has a new form that requires less code when reading a file straight into the control. 'previous form (still works) open "filename.txt" for input as #1 h$ = input$(#1, lof(#1)) print #win.te, "!contents h$"; close #1 'new form (less code and much faster) open "filename.txt" for input as #1 'see how we specify the file handle instead of a string variable print #win.te, "!contents #1"; close #1 17) Setting up a FOR/NEXT loop that counts backwards and would never reach its limit would simply skip over the loop when running in the development environment, but when running a *.TKN file it would bomb (even using the runtime engine). This has been fixed. Here is an example of a loop that would bomb in v1.3: for x = 1 to 0 {some code} next x 18) Added the ability to set the label for a prompter dialog using the same method as for a notice dialog like so: prompt "This is the title" + chr$(13) + "Enter something"; a$ 19) Fixed a bug that would sometimes produce an error: 'syncControlEvent: not understood by BasicGraphPane' 20) Added a CommandLine$ variable that contains the parameter contents of the command line. 21) Added some startup options to LIBERTY.EXE including: -R Run a BAS file on startup -D Debug a BAS file on startup --------the following three are in the registered version only-------- -T Make a TKN file from a BAS file on startup -A Automatically Exit LB on completion of BAS file -M Minimize the Liberty BASIC editor on startup Examples: LIBERTY -R -M PROG.BAS 'run PROG.BAS with editor minimized LIBERTY -T -A PROG.BAS 'create a TKN file from PROG.BAS then exit LIBERTY -D PROG.BAS 'run the debugger on PROG.BAS 22) FIXED! LB would report the following error if the developer tried to build a window with a groupbox that contains one or more graphicbox controls: "y" not understood by UndefinedObject Additionally, the bug would also cause the following error to be reported when the user exits Liberty BASIC (or LB would stop responding to user input altogether): "assignByName:toBe:" not understood by UndefinedObject 23) Made some changes to the way the unsaved changes and quit confirmation dialogs work and the way they are presented when quitting Liberty BASIC. 24) FIXED! The common file dialogs would be improperly initialized on startup with incorrect default pathname info. This caused a few subtle problems. 25) Changed the way that strings are passed into API calls. By default, Liberty BASIC copies a string and adds a terminating ASCII zero to the copy. Most Windows API calls expect this kind of zero terminated string. The problem was though that since only a copy of the original string was passed to the API function, if the function then modifies that string directly (as in the kernel API function GetProfileString and a few others), then the Liberty BASIC application calling the function could not access the modified string because only the copy is modified. The way to fix this now is to write code that adds the ASCII zero onto the end of the string before making the call. Liberty BASIC then checks for the ASCII zero, and if it finds it, passes the original string and does not make a copy. This is only necessary if your application passes a string, expecting to get it back modified by the API or DLL function called. Here is a quick snippet to get printer info using the GetProfileString API call: 'getpstr.bas - Get information using the GetProfileString API call open "kernel.dll" for dll as #kernel appName$ = "windows" keyName$ = "device" default$ = "" 'add an ASCII zero so Liberty BASIC will not pass a copy of result$ 'into the API call, but the actual contents of result$ result$ = space$(49)+chr$(0) size = 50 calldll #kernel, "GetProfileString",_ appName$ as ptr,_ keyName$ as ptr,_ default$ as ptr,_ result$ as ptr,_ size as short,_ result as short close #kernel 'display the retrieved information up to but not including the 'terminating ASCII zero print left$(result$, instr(result$, chr$(0)) - 1) input r$ 26) FIXED! When using random access files, using PUT to save one or more records and then using GET without first closing the file and reopening it could cause some loss of data. Liberty BASIC now properly flushes file buffers correctly before permitting GET to be used after PUT. 27) FIXED! A bug was fixed that caused all texteditor panes in the same window to adopt the font specified by the font command. 28) Font control was added to the following controls: TEXTBOX, BUTTON, STATICTEXT, CHECKBOX, RADIOBUTTON. 29) The runtime engine will now run a TKN file matching the name of the runtime engine. If you rename your runtime engine ULTIPROG.EXE and name your TKN file ULTIPROG.TKN, then the runtime engine will execute ULTIPROG.TKN on startup. NOTICE: To retain compatibility with LB v1.3 the runtime engine will first look for and run STARTUP.TKN if it is there. 30) Added a Setup option to backup your source code to a *.bak file. This comes in handy when calling Windows API functions or when using third party DLLs. When you run (or debug) with this option checked, Liberty BASIC will save your code in its current state in a *.bak file. Then if Liberty BASIC crashes, your code will be saved to a *.bak file from which you can recover your work. 31) Added INP() for reading a byte from a I/O port, and OUT for sending a byte to an I/O port. These use the same syntax as those in Microsoft BASICs. NOTICE: It is considered somewhat reckless to use these inside of Windows because there is no way to control who is reading or writing to an I/O port. 32) Added a SPACE$() function. This function returns the specified number of ASCII 32 characters in a string. For example: for x = 1 to 10 print space$(x); "*" next x 33) FIXED! Bolstered syntax checking in assignment statements. For example, compiling the following would halt without highlighting the errant line, and it would produce a cryptic error "attempt to access an absent element". Now it properly highlights the line and produces a syntax error notification. for x = 1 to 10 print space$(x)); "*" next x 34) Added a HEXDEC function that converts a hexadecimal number expressed in a string into a decimal numeric value. This can be very useful when converting #defines in header files from C or some other language for use in Liberty BASIC. Here's a hypothetical example: REDRAW.SPECIAL = hexdec("0A") PAL.AUTO = hexdec("01") stylebits = REDRAW.SPECIAL or PAL.AUTO